/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.yandex.skipass;

import java.util.Calendar;

/**
 *
 * @author Brothers
 */
public class SkiPass {

    public enum PassType {

        Work, Season;
    }

    public enum LiftEnum {

        Ten(10), Twenty(20), Fifty(50), Hundred(100);
        private final int number;

        LiftEnum(int i) {
            this.number = i;
        }

        public int getEnum() {
            return this.number;
        }
    }

    public enum SeasonEnum {

        Ninty(90);
        private final int number;

        SeasonEnum(int i) {
            this.number = i;
        }

        public int getEnum() {
            return this.number;
        }
    }

    public enum TimeEnum {

        First(9, 13), Second(13, 17);
        final int down;
        final int up;

        TimeEnum(int i, int j) {
            this.down = i;
            this.up = j;
        }

        public int getDownTime() {
            return this.down;
        }

        public int getUpTime() {
            return this.up;
        }
    }

    private int id;
    private Calendar firstDate;
    private boolean access;
    private PassType type;
    private Week ogr;

    public SkiPass() {
        this.id = 0;
        this.access = true;
    }

    public int getId() {
        return this.id;
    }

    public void setSkypass(int idPass, PassType typePass,
            Calendar firstDatePass, Week ogrPass) {
        this.id = idPass;
        this.firstDate = firstDatePass;
        //this.firstDate.setTime(firstDatePass.getTime());
        this.ogr = ogrPass;
        this.type = typePass;
    }

    public void blockPass() {
        this.access = false;
    }

    public int getNumberLift() {
        if (this instanceof Lift) {
            return this.getNumberLift();
        } else {
            return -1;
        }
    }

    protected void setNumberLift(int i) {
        if (this instanceof Lift) {
            this.setNumberLift(i);
        }
    }

    public int getNumberDay() {
        if (this instanceof Day) {
            return this.getNumberDay();
        } else {
            return -1;
        }
    }

    protected void setNumberDay(int i) {
        if (this instanceof Day) {
            this.setNumberDay(i);
        }
    }

    public boolean getPassAccess() {
        return this.access;
    }

    public Calendar getFirstDate() {
        return this.firstDate;
    }

    public boolean isValidDate(Calendar date) {
        if (this instanceof Season) {
            return this.isValidDate(date);
        } else {
            return false;
        }
    }

    public boolean isDayInOgr(Calendar day) {
        return this.ogr.takeDayConditions(day.DAY_OF_WEEK);
    }

    public void setDays(int days, int time) {
        if (this instanceof Day) {
            this.setDays(days, time);
        }
    }

    public Week getOgr() {
        return this.ogr;
    }
}
